import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)
export const constantRoutes = [
  { path: '/', redirect: '/home' },
  {
    path: '/',
    name: 'app',
    component: () => import('@/views/layout/index'),
    // component: resolve => require(['@/views/layout/index'], resolve),
    meta: {
      keepAlive: false
    },
    children: [{
      path: 'home',
      name: 'home',
      component: () => import('@/views/home'),
      // component: resolve => require(['@/views/home/index'], resolve),
      meta: {
        keepAlive: false,
        title: '预防与健康'
      }
    }, {
      path: 'articles',
      name: 'articles',
      component: () => import('@/views/articles'),
      // component: resolve => require(['@/views/me/index'], resolve),
      meta: {
        keepAlive: false,
        title: '资 讯'
      }
    }]
  },
  {
    path: '/inoculantManage',
    name: 'inoculantManage',
    component: () => import(/* webpackChunkName: "orderList" */ '@/views/inoculantManage'),
    // component: resolve => require(['@/views/orderList/detail'], resolve),
    meta: {
      keepAlive: false,
      transition: true,
      title: '接种人管理'
    }
  }, {
    path: '/feedbackManage',
    name: 'feedbackManage',
    component: () => import(/* webpackChunkName: "orderList" */ '@/views/feedbackManage'),
    // component: resolve => require(['@/views/orderList/detail'], resolve),
    meta: {
      keepAlive: false,
      transition: true,
      title: '反馈信息'
    }
  },
  {
    path: '/consent',
    name: 'consent',
    component: () => import(/* webpackChunkName: "orderList" */ '@/views/consent'),
    // component: resolve => require(['@/views/orderList/detail'], resolve),
    meta: {
      keepAlive: false,
      transition: true,
      title: '知情同意书'
    }
  },
  {
    path: '/consentDetail/:id',
    name: 'consentDetail',
    component: () => import(/* webpackChunkName: "orderList" */ '@/views/consent/detail'),
    // component: resolve => require(['@/views/orderList/detail'], resolve),
    meta: {
      keepAlive: false,
      transition: true,
    }
  },
 
  {
    path: '/articles',
    name: 'articles',
    component: () => import(/* webpackChunkName: "articles" */ '@/views/articles/index'),
    // component: resolve => require(['@/views/articles/index'], resolve),
    meta: {
      keepAlive: false,
      title: '资讯'
    }
  },
  {
    path: '/articleDetail/:id',
    name: 'articleDetail',
    component: () => import(/* webpackChunkName: "articleDetail" */ '@/views/articles/detail'),
    // component: resolve => require(['@/views/articles/detail'], resolve),
    meta: {
      keepAlive: false,
      title: '资讯详情'
    }
  },
  {
    path: '/notice',
    name: 'notice',
    component: () => import(/* webpackChunkName: "articles" */ '@/views/notice/index'),
    // component: resolve => require(['@/views/articles/index'], resolve),
    meta: {
      keepAlive: false,
      title: '门诊公告'
    }
  },
  {
    path: '/noticeDetail/:id',
    name: 'noticeDetail',
    component: () => import(/* webpackChunkName: "articles" */ '@/views/notice/detail'),
    // component: resolve => require(['@/views/articles/index'], resolve),
    meta: {
      keepAlive: false,
      title: '消息详情'
    }
  },
]

const createRouter = () =>
  new Router({
    mode: 'history', // require service support
    // base: '/app/',
    scrollBehavior: () => ({
      y: 0
    }),
    routes: constantRoutes
  })

export default createRouter()
